import http from '../../http/http'
import * as url from "../../http/api";
const state = {
    //模拟订单
    ddData:[
        // {number: '001', createTime: '2020-03-27 10:50:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '002', createTime: '2020-03-27 10:51:27', createBy: '蔡徐坤', orderType: '外卖', seatsId: '无', totalPrice: '128', mainState: '已完成',},
        // {number: '003', createTime: '2020-03-27 10:52:27', createBy: '王小虎', orderType: '堂食', seatsId: '5', totalPrice: '55', mainState: '已完成',},
        // {number: '004', createTime: '2020-04-01 10:53:27', createBy: '鹿晗', orderType: '堂食', seatsId: '6', totalPrice: '118', mainState: '已完成',},
        // {number: '005', createTime: '2020-03-27 10:54:27', createBy: '王小虎', orderType: '堂食', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '006', createTime: '2020-03-27 10:55:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '007', createTime: '2020-04-02 10:56:27', createBy: '吴亦凡', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '008', createTime: '2020-03-27 11:50:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '009', createTime: '2020-03-27 11:52:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '010', createTime: '2020-03-27 11:53:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '011', createTime: '2020-03-27 11:54:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '012', createTime: '2020-03-27 11:55:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '013', createTime: '2020-03-27 11:56:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '014', createTime: '2020-03-27 11:57:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '015', createTime: '2020-03-27 11:58:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '016', createTime: '2020-03-27 11:59:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '017', createTime: '2020-03-27 12:10:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '018', createTime: '2020-03-27 12:15:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '019', createTime: '2020-03-27 12:20:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '020', createTime: '2020-03-27 12:25:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '021', createTime: '2020-03-27 12:30:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '022', createTime: '2020-03-27 13:10:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '023', createTime: '2020-03-27 13:15:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '024', createTime: '2020-03-27 13:20:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '025', createTime: '2020-03-27 13:25:27', createBy: '王小虎', orderType: '外卖', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '026', createTime: '2020-03-27 13:30:27', createBy: '王小虎', orderType: '堂食', seatsId: '无', totalPrice: '18', mainState: '已完成',},
        // {number: '027', createTime: '2020-03-27 14:10:27', createBy: '王小虎', orderType: '堂食', seatsId: '无', totalPrice: '18', mainState: '已完成',},
    ],
    ygData:[
        {name: 'waiter',password:'32156', sex: '女', number: '009', storeId: '服务员', baseSalary: '500', tel: '18534488748', },
    ],
    orderSearch:[],
    tablePage: 1,
};
const actions = {
    getOrder({commit}){
        http({
            url:'/website/Employeecontroller/selectDiningOrderMain',
            method:'post',
            data:{ }
        }).then(res =>{
            if(res.status == 200){
                commit('getOrderData',res.data)
                console.log(res.data)
            }
            return res.data
        }).catch(err =>{
            console.log(err)
        })
    },
    orderSearch({commit},obj){
        commit('orderSearch', obj)
    },
    selfInfo({commit}){
        let userobj={
            name: sessionStorage.getItem('userName')
        }
        http({
            url:'/website/Employeecontroller/queryInfo',
            method:'post',
            data:{userobj}
        }).then(res =>{
            if(res.status == 200){
                commit('userInfo',res.data)
                console.log(res.data)
            }
            return res.data
        }).catch(err =>{
            console.log(err)
        })
    }
};
const mutations = {
    getOrderData(state,data){
        state.ddData=data
    },
    orderSearch(context, obj) {
        let { selectValue, inputValue } = obj
        state.orderSearch = (state.ddData.filter(item => item[selectValue] == inputValue))
    },
    userInfo(state,data){
        state.ygData=data
    },
};
const getters = {};
export default {
    state,
    actions,
    mutations,
    getters
}